<?php
    class Integral_logAction extends AppAction{
        public function _initialize(){
            $this->model=new App_Integral_logModel();
        }
        //个人总积分   1011
        public function total(){
            if($_POST['requestType']=='1011'){
                if($_POST['userId']&&$_POST['requestId']){
                    if($this->belong($_POST['requestId'],$_POST['userId'])){
                        $map['site_id']=__SITEID__;
                        $map['member_id']=$_POST['requestId'];
                        if($_POST['integralType']){
                            $map['type_id']=$_POST['integralType'];//积分类型ABV
                        }
                        if($_POST['dateFrom']&&$_POST['dateTo']){
                            $map['time']=array('between',array(strtotime($_POST['dateFrom']),strtotime($_POST['dateTo'])));
                        }elseif($_POST['dateFrom']){
                            $map['time']=array('gt',strtotime($_POST['dateFrom']));
                        }elseif($_POST['dateTo']){
                            $map['time']=array('lt',strtotime($_POST['dateTo']));
                        }
                        $data=$this->model->total($map);
                        $this->callback($data);
                    }
                }
            }
        }
        //个人积分详情  1001
        public function detail(){

//            $map['i.site_id']=__SITEID__;
//            $map['i.member_id']=$this->_param('requestId');
//            $map['i.type_id']=$this->_param('integralType');//积分类型ABV
//            if($this->_param('dateFrom')&&$this->_param('dateTo')){
//                $map['i.time']=array('between',array(strtotime($this->_param('dateFrom')),strtotime($this->_param('dateTo'))));
//            }elseif($this->_param('dateFrom')){
//                $map['i.time']=array('gt',strtotime($this->_param('dateFrom')));
//            }elseif($this->_param('dateTo')){
//                $map['i.time']=array('lt',strtotime($this->_param('dateTo')));
//            }
//            $data=$this->model->detail($map);
//            $this->callback($data);

            if($_POST['requestType']=='1001'){
                if($_POST['userId']&&$_POST['requestId']){
                    if($this->belong($_POST['requestId'],$_POST['userId'])){
                        $map['i.site_id']=__SITEID__;
                        $map['i.member_id']=$_POST['requestId'];
                        if($_POST['integralType']){
                            $map['i.type_id']=$_POST['integralType'];//积分类型ABV
                        }
                        if($_POST['dateFrom']&&$_POST['dateTo']){
                            $map['i.time']=array('between',array(strtotime($_POST['dateFrom']),strtotime($_POST['dateTo'])));
                        }elseif($_POST['dateFrom']){
                            $map['i.time']=array('gt',strtotime($_POST['dateFrom']));
                        }elseif($_POST['dateTo']){
                            $map['i.time']=array('lt',strtotime($_POST['dateTo']));
                        }
                        $data=$this->model->detail($map);
                        $this->callback($data);
                    }
                }
            }
        }
    }